package com.andnnl.template;

import java.util.*;

/**
 * Created by chenss on 2024/8/26.
 */
public class KeyWordMatchTest {
    public static void main(String[] args) {
        List<KeyWord> keys = new ArrayList<>();
        keys.add(new KeyWord("大", 1));
        keys.add(new KeyWord("大小", 2));
        keys.add(new KeyWord("小", 3));
        keys.add(new KeyWord("Big", 4, 1));
        keys.add(new KeyWord("biG", 5, 0));
        keys.add(new KeyWord("BIG", 6, 1));
        keys.add(new KeyWord("small", 6, 0));
        keys.add(new KeyWord("This word is Big bBIG", 7, 1,true));
        keys.add(new KeyWord("this word is", 7, 0,false,true));
        keys.add(new KeyWord("this word", 7, 0,false,false));

        TrieJy<KeyWord> trie = new TrieJy();
        for (KeyWord key : keys) {
            trie.insert(key.keyword, key);
        }

//        System.out.println(trie.search("这个字是大")); // 输出 "大小"
//        System.out.println(trie.search("这个字是小")); // 输出 "小"
//        System.out.println(trie.search("这个字是大小ss")); // 输出 "小"
        final List<KeyWord> this_word_is_big = trie.search("This word is Big bbIG", KeyWord.MatchFunc,true,true);
        for (KeyWord keyWord : this_word_is_big) {
            System.out.println(keyWord); // 输出 "Big"
        }


//        final List<KeyWord> this_word_is_big = trie.search("This word is Big", KeyWord.MatchFunc);
//        for (KeyWord keyWord : this_word_is_big) {
//            System.out.println(keyWord); // 输出 "Big"
//        }

//        System.out.println(trie.search("This word is big")); // 输出 "Big"
//        System.out.println(trie.search("This word is Small")); // 输出 "Small"
    }
}


